package com.bong.ring.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.KeyEvent;
import android.view.View;

import com.bong.ring.MainActivity;
import com.bong.ring.R;
import com.bong.ring.view.MyView;
import com.tencent.android.tpush.XGPushConfig;

public class SplashActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);
        XGPushConfig.enableDebug(getApplicationContext(),true);
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                finish();
                startActivity(new Intent(SplashActivity.this,MainActivity.class));
            }
        },1000);
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if(findViewById(R.id.my_view).getVisibility()== MyView.VISIBLE)
        {
            findViewById(R.id.my_view).setVisibility(View.GONE);
        }
        else
        {
            findViewById(R.id.my_view).setVisibility(View.VISIBLE);
        }
        return true;
    }
}
